package properties;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class properties02 {
    public static void main(String[] args) throws IOException {
        //使用properties读取 mysql.properties 文件
        Properties properties = new Properties();
        //load:加载指定配置文件
        properties.load(new FileReader("src\\mysql.properties"));
        //list:输出k-v
        properties.list(System.out);
        //根据key，获取value
        String user = properties.getProperty("user");
        System.out.println("user:" + user);
        String pwd = properties.getProperty("pwd");
        System.out.println("pwd:" + pwd);





    }
}
